﻿var extitemedit = {
    formDefine: {
        labelWidth: 60, inputWidth: 200, space: 10, labelAlign: 'right',
        fields: [
                    { display: lang.element_value + "：", name: "ITEM_CODE", type: "text", newline: true, width: 280 },
                    { display: lang.save, name: "search", type: "button", newline: true, nlstyle: "text-align:center", width: 280, click: function () { extitemedit.form.submit(); } },
                    { display: lang.close, name: "close", type: "button", width: 280, click: function () {
                        parent.$.closePage();
                    }
                    }
                ],
        submitUrl: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        submitUrlType: "EditExtItem",
        submitCheck: function (params) {
            if (!params["ITEM_CODE"] || params["ITEM_CODE"] == "") {
                return lang.element_name_can_not_be_empty;
            }

            return "";
        },
        submitParams: function (params) {
            params.EXT_ID = $.getPara('dicttypeid');
            params.action = 2;
            return params;
        },
        submitSuccess: function (data) {
            if (data) {
                $.alert(lang.add_new_element_success, null, function () { parent.extitemlist.search(); parent.$.closePage(); });
            }
            else {
                $.alert(lang.The_element_already_exists);
            }
        }
    },
    init: function () {
        jsPageRender(this);
    }
};